Skip to main content

Class ModuleBase<T>

Provides a base class for a command module to inherit from.

Assembly: Discord.Net.Commands.dll​
View Source​
Declaration
public abstract class ModuleBase<T> : IModuleBase where T : class, ICommandContext

Properties​

Context​

The underlying context of the command.

View Source​
Declaration
public T Context { get; }

Methods​

ReplyAsync(String, Boolean, Embed, RequestOptions, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[])​

Sends a message to the source channel.

View Source​
Declaration
protected virtual async Task<IUserMessage> ReplyAsync(string message = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent component = null, ISticker[] stickers = null, Embed[] embeds = null)
Returns​

System.Threading.Tasks.Task<Discord.IUserMessage>

Parameters​
TypeNameDescription
System.Stringmessage

Contents of the message; optional only if <code data-dev-comment-type="paramref" class="paramref">embed</code> is specified. | | System.Boolean | isTTS | Specifies if Discord should read this <code data-dev-comment-type="paramref" class="paramref">message</code> aloud using text-to-speech. | | Discord.Embed | embed | An embed to be displayed alongside the <code data-dev-comment-type="paramref" class="paramref">message</code>. | | Discord.RequestOptions | options | The request options for this async request. | | Discord.AllowedMentions | allowedMentions | Specifies if notifications are sent for mentioned users and roles in the <code data-dev-comment-type="paramref" class="paramref">message</code>. If null, all mentioned roles and users will be notified. | | Discord.MessageReference | messageReference | The message references to be included. Used to reply to specific messages. | | Discord.MessageComponent | component | The message components to be included with this message. Used for interactions. | | Discord.ISticker[] | stickers | A collection of stickers to send with the file. | | Discord.Embed[] | embeds | A array of Discord.Embeds to send with this response. Max 10. |

BeforeExecute(CommandInfo)​

The method to execute before executing the command.

View Source​
Declaration
protected virtual void BeforeExecute(CommandInfo command)
Parameters​
TypeNameDescription
Discord.Commands.CommandInfocommandThe Discord.Commands.CommandInfo of the command to be executed.

AfterExecute(CommandInfo)​

The method to execute after executing the command.

View Source​
Declaration
protected virtual void AfterExecute(CommandInfo command)
Parameters​
TypeNameDescription
Discord.Commands.CommandInfocommandThe Discord.Commands.CommandInfo of the command to be executed.

OnModuleBuilding(CommandService, ModuleBuilder)​

The method to execute when building the module.

View Source​
Declaration
protected virtual void OnModuleBuilding(CommandService commandService, ModuleBuilder builder)
Parameters​
TypeNameDescription
Discord.Commands.CommandServicecommandServiceThe Discord.Commands.CommandService used to create the module.
Discord.Commands.Builders.ModuleBuilderbuilderThe builder used to build the module.